﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BlockController : MonoBehaviour
{

    private PlayerController playerController;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("player enter");
        playerController = collision.GetComponent<PlayerController>();        
    }    

    private void OnTriggerStay2D(Collider2D collision)
    {
        Debug.Log("player stay");
        playerController.speedFactor = 0.2f;
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        playerController.speedFactor = 1f;
    }
}
